@import "./variables.less";

@menuTop: 1.22667rem;
@menuWidth: 62px;
@iconFontSize: 24px;
@iconWidth: 32px;

.setMenuActive() {
  &.active {
    >a {
      color: @primary-color * 0.718;
      background: #fff;
    }
  }
}

.toggleMenuClass() {
  >.btn-toggle {
    font-size: @iconFontSize;
    padding-bottom: 5px;
    display: inline-block;
    text-align: right;
    width: 100%;
    top: 13px;
    position: relative;

    i {
      padding-right: 11px;
      background-color: @primary-color * 0.718;
      padding: 8px;
      margin-right: 3px;
      cursor: pointer;
    }

    &:hover {
      i {
        background: @primary-color*1.2;
        padding: 10px;
        border-radius: 8px;
      }
    }
  }
}

.menus {
  width: @menuWidth;
  z-index: 99;
  position: absolute;
  font-size: 12px;
  top: @menuTop;
  color: #fff;
  padding-top: 0;
  background-color: @primary-color * 0.718;
  border-right: 1px solid @primary-color * 0.718;
  user-select: none;
  margin-top: 0;
  overflow-y: auto;
  overflow-x: hidden;
  .toggleMenuClass();

  >.nav-list {
    list-style: none;
    padding: 0;
    min-height: 500px;
    padding-top: 10px;
    padding-bottom: 20px;

    a,
    a:hover,
    a:focus {
      color: #fff;
      display: flex;
      flex-flow: row nowrap;
      width: 100%;
      padding: 5px 0px;
      line-height: 1;
      vertical-align: middle;
      text-decoration: none;
      background-color: @primary-color * 0.718;

      >span {
        flex: 1;
        padding-left: 8px;
        line-height: 32px;
        vertical-align: middle;
      }
    }

    .nav-item {
      display: inline-block;
      margin-bottom: 5px;
      line-height: 1;
      vertical-align: middle;
      margin-left: calc((@menuWidth - @iconWidth) / 8);
      .setMenuActive();

      >a {
        cursor: pointer;
        padding: 5px;
        text-align: center;
        background: @primary-color*1.068;

        &:hover {
          background-color: @primary-color*1.08;
        }

        >.menu-icon {
          &:before {
            width: @iconWidth;
            height: @iconWidth;
            display: inline-block;
            text-align: center;
            top: 3px;
            position: relative;
          }

          font-size: @iconFontSize;
          line-height: 1;
        }

        >b {
          float: right;
          padding-top: 2px;
          padding-right: 12px;
          line-height: 24px;
          vertical-align: middle;
        }
      }

      &.open {
        >a {
          font-weight: bold;
          background-color: @primary-color*1.38;
        }

        >ul.submenu {
          display: inline-block;
          width: 100%;
        }
      }

      ul.submenu {
        display: none;
        list-style: none;

        .dropdown-toggle {
          cursor: pointer;

          >span {
            line-height: 14px;
          }

          >.arrow {
            float: right;
            margin-right: 5px;
          }
        }

        ul.submenu {
          width: 100%;
          display: inline-block;

          >li {
            >a {
              padding-left: 40px;
            }
          }
        }

        .menu-icon {
          font-size: 10px;
        }

        >li {
          &:first-of-type {
            margin-top: 3px;
          }

          >a {
            padding: 10px 0;
            padding-left: 20px;

            &:hover {
              background: @primary-color*1.28;
            }

            >i {
              padding-right: 8px;
            }
          }

          .setMenuActive();
        }
      }
    }
  }
}

.collapse-menus {
  z-index: 99;

  >.menus {
    width: @menuWidth;
    display: inline-block;

    >.nav-list {
      a {
        color: #fff;
        background: @primary-color * 0.718;

        >.menu-icon {
          &:before {
            line-height: 1;
          }

          padding: 5px;
        }

        >span {
          display: none;
        }

        >b {
          display: none;
        }
      }

      >.nav-item {

        &:hover,
        &.hover,
        &.open {
          >a {
            background: @primary-color * 0.718;

            >.menu-icon {
              border-radius: 10px;
              background: @primary-color * 1;
            }
          }
        }

        &.open {
          >ul.submenu {
            display: none;
          }
        }

        &.active {
          a {
            background: @primary-color * 0.718;

            >.menu-icon {
              border-radius: 10px;
              color: @primary-color * 0.718;
              background: #fff;
            }
          }
        }
      }

      >ul.submenu {
        display: none;
      }
    }
  }
}

.popover-menus {
  top: 0;
  left: @menuWidth;
  color: #000;
  position: fixed;
  width: calc(100% - @menuWidth);
  padding: 0;
  z-index: 10000;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.418);
  font-family: PingFangSC-Medium, PingFang SC;
  border: 1px solid @primary-color * 0.718;

  >.details {
    width: 250px;
    height: 100%;
    top: @menuTop;
    position:relative;
    font-size: @iconFontSize*0.65;
    background: #fff;

    >b {
      width: calc(100% - 10px);
      display: inline-block;
      padding: 10px 0 10px 10px;
      font-size: @iconFontSize;
      font-weight: bold;
      line-height: 1.2;
    }

    a {
      padding: 5px 10px;
      display: block;
      font-size: @iconFontSize*0.65;
      font-weight: 400;
      color: #333;
      line-height: 1.2;
    }

    .submenu {
      width: calc(100% - 5px);
      list-style: none;
      font-size: @iconFontSize*0.65;
      line-height: 1.2;
      display: inline-block;
      padding: 0 0 0 5px;

      .submenu {
        background: #fff;

        a {
          padding-left: 30px;
        }

        li {
          background: #fff;
        }
      }

      a {
        vertical-align: middle;
        padding: 4px 15px 4px 25px;
      }

      >li {
        &.active {
          background: #ebf5ff;

          a {
            font-weight: 500;
            color: #1e91e8;
          }
        }
      }
    }
  }
}

.iwf-icon-hover() {
  .iwf-home:before {
    background-position: -10px -374px;
  }

  .iwf-apply:before {
    background-position: -10px -62px;
  }

  .iwf-workflow:before {
    background-position: -10px -686px;
  }

  .iwf-baseinfo:before {
    background-position: -10px -166px;
  }

  .iwf-systeminfo:before {
    background-position: -10px -478px;
  }

  .iwf-doa:before {
    background-position: -10px -270px;
  }

  .iwf-track:before {
    background-position: -10px -582px;
  }
}

.iwf-icon {
  position: relative;
  top: 0 !important;
  font-size: 24px;

  &:before {
    content: " ";
    display: inline-block;
    background: url("images/menu-icons.png") no-repeat -10px -322px;
    height: 32px;
    width: 32px;
  }

  &.iwf-home:before {
    background-position: -10px -322px;
  }

  &.iwf-apply:before {
    background-position: -10px -10px;
  }

  &.iwf-workflow:before {
    background-position: -10px -634px;
  }

  &.iwf-baseinfo:before {
    background-position: -10px -114px;
  }

  &.iwf-systeminfo:before {
    background-position: -10px -426px;
  }

  &.iwf-doa:before {
    background-position: -10px -218px;
  }

  &.iwf-track:before {
    background-position: -10px -530px;
  }
}

.nav-item {
  &.active {
    .iwf-icon-hover();
  }

  &.open {
    >a {
      .iwf-icon {
        .iwf-icon-hover();
      }
    }
  }
}